<template>
    <div>
        <el-row style="height:50px;font-size:20px;margin-left:20px;margin-right:20px;" >
            <el-col :span="21" style="height:50px;" class="goCenterUp">
                <el-breadcrumb separator=">">
                    <el-breadcrumb-item :to="{ path: '/home/firstPage' }">后台管理</el-breadcrumb-item>
                    <el-breadcrumb-item>管理</el-breadcrumb-item>
                    <el-breadcrumb-item>委培管理</el-breadcrumb-item>
                    <el-breadcrumb-item>审核委培</el-breadcrumb-item>
                </el-breadcrumb>
            </el-col>
            <el-col :span="1" style="height:50px;" class="goCenterUp">
                <el-button size="mini" @click="boHui">驳回</el-button>
            </el-col>
            <el-col :span="1" :offset="1" style="height:50px;" class="goCenterUp">
                <el-button type="primary" size="mini" @click="faBu">发布</el-button>
            </el-col>
        </el-row>
        <div class="line"></div>
        <el-container>
            <el-header>
                <el-row style="height:100%;">
                    <el-col :span="8" style="height:100%;" class="juZhong">
                        <div>
                            <i class="el-icon-suitcase" style="font-size:20px;color:#409EFF;font-weight:600;"></i>
                            <span style="font-size:20px;color:#409EFF;font-weight:600;">{{'委培岗位:'+consignName}}</span>
                        </div>
                    </el-col>
                    <el-col :span="8" style="height:100%;" class="juZhong">
                        <div>
                            <i class="el-icon-office-building" style="font-size:20px;color:#409EFF;font-weight:600;"></i>
                            <span style="font-size:20px;color:#409EFF;font-weight:600;">{{'公司:'+companyName}}</span>
                        </div>
                    </el-col>
                    <el-col :span="8" style="height:100%;" class="juZhong">
                        <div>
                            <i class="el-icon-user" style="font-size:20px;color:#409EFF;font-weight:600;"></i>
                            <span style="font-size:20px;color:#409EFF;font-weight:600;">{{'委培人数：'+consignNum+'人'}}</span>
                        </div>
                    </el-col>
                </el-row>       
            </el-header>
            <div class="line"></div>
             <el-main style="padding:20px;">
                 <el-row style="margin-left:60px;margin-right:60px;">
                    <el-row>
                        <i class="el-icon-edit-outline" style="font-size:25px;color:#409EFF;"></i>
                        <span style="color:#409EFF">委培详情</span>
                    </el-row>
                    <el-row style="height:270px;margin-top:10px;">
                        <el-col>
                            <el-row > 
                                <span style="font-size:14px;margin-left:25px;color:#909090;">委托方：{{consignOutline.client}}</span>
                            </el-row>
                            <el-row style="margin-top:10px">
                                <span style="font-size:14px;margin-left:25px;color:#909090;">受托方：新职通</span>
                            </el-row>
                            <el-row style="margin-top:10px">
                                <span style="font-size:14px;margin-left:25px;color:#909090;">委培单位：{{consignOutline.consignUnit}}</span>
                            </el-row>
                            <el-row style="margin-top:10px">
                                <span style="font-size:14px;margin-left:25px;color:#909090;">委培地址：{{consignOutline.consignAddress}}</span>
                            </el-row>
                            <el-row style="margin-top:10px">
                                <span style="font-size:14px;margin-left:25px;color:#909090;">委培时间：{{consignOutline.consignTime}}</span>
                            </el-row>
                            <el-row style="margin-top:10px">
                                <span style="font-size:14px;margin-left:25px;color:#909090;">委培内容：{{consignOutline.consignText}}</span>
                            </el-row>
                            <el-row style="margin-top:10px">
                                <span style="font-size:14px;margin-left:25px;color:#909090;">委培要求：</span>
                                <span v-for="item in consignOutline.consignRequest" :key="item" style="font-size:14px;color:#909090;">{{item}}</span>
                            </el-row>
                            <el-row style="margin-top:10px">
                                <span style="font-size:14px;margin-left:25px;color:#909090;">报名时间：{{consignOutline.consignDeadline}}</span>
                            </el-row>
                            <el-row style="margin-top:10px">
                                <span style="font-size:14px;margin-left:25px;color:#909090;">其他说明：{{consignOutline.consignOtherNotice}}</span>
                            </el-row>
                        </el-col>
                    </el-row>
                </el-row>
                <el-row style="margin-left:60px;margin-right:60px;margin-top:20px;">
                    <el-row>
                        <i class="el-icon-bank-card" style="font-size:25px;color:#409EFF;"></i>
                        <span style="color:#409EFF">工资待遇</span>
                    </el-row>
                    <el-row style="height:60px;margin-top:10px;">
                        <el-col>
                            <el-row > 
                                <span style="font-size:14px;margin-left:25px;color:#909090;">基本工资：{{salaryOutline.baseSalary+'元/月'}}</span>
                            </el-row>
                            <el-row style="margin-top:10px">
                                <span style="font-size:14px;margin-left:25px;color:#909090;">发薪日期：{{'每月'+salaryOutline.salaryDate+'号'}}</span>
                            </el-row>
                            <el-row style="margin-top:10px">
                                <span style="font-size:14px;margin-left:25px;color:#909090;">结算方式：{{salaryOutline.payType+'结'}}</span>
                            </el-row>
                            <el-row style="margin-top:10px">
                                <span style="font-size:14px;margin-left:25px;color:#909090;">其他说明：{{salaryOutline.salaryOtherNotice}}</span>
                            </el-row>
                        </el-col>
                    </el-row>
                </el-row>
                <el-row style="margin-left:60px;margin-right:60px;margin-top:20px;">
                    <el-row>
                        <i class="el-icon-fork-spoon" style="font-size:25px;color:#409EFF;"></i>
                        <span style="color:#409EFF">住宿饮食</span>
                    </el-row>
                    <el-row style="height:60px;margin-top:10px;">
                        <el-col>
                            <el-row > 
                                <span style="font-size:14px;margin-left:25px;color:#909090;">住宿说明：{{liveAndFoodOutline.liveNotice}}</span>
                            </el-row>
                            <el-row style="margin-top:10px">
                                <span style="font-size:14px;margin-left:25px;color:#909090;">饮食说明：{{liveAndFoodOutline.foodNotice}}</span>
                            </el-row>
                            <el-row style="margin-top:10px">
                                <span style="font-size:14px;margin-left:25px;color:#909090;">社保说明：{{liveAndFoodOutline.securityNotice}}</span>
                            </el-row>
                            <el-row style="margin-top:10px">
                                <span style="font-size:14px;margin-left:25px;color:#909090;">其他说明：{{liveAndFoodOutline.liveFoodOtherNotice}}</span>
                            </el-row>
                        </el-col>
                    </el-row>
                </el-row>
                <el-row style="margin-left:60px;margin-right:60px;margin-top:20px;">
                    <el-row>
                        <i class="el-icon-s-order" style="font-size:25px;color:#409EFF;"></i>
                        <span style="color:#409EFF">岗位要求</span>
                    </el-row>
                    <el-row style="height:60px;margin-top:10px;">
                        <el-col>
                            <el-row > 
                                <span style="font-size:14px;margin-left:25px;color:#909090;">工作内容：{{professionRequest.jobNotice}}</span>
                            </el-row>
                            <el-row style="margin-top:10px">
                                <span style="font-size:14px;margin-left:25px;color:#909090;">工作时间：{{professionRequest.jobTimeNotice}}</span>
                            </el-row>
                            <el-row style="margin-top:10px">
                                <span style="font-size:14px;margin-left:25px;color:#909090;">工作方式：{{professionRequest.job_way}}</span>
                            </el-row>
                            <el-row style="margin-top:10px">
                                <span style="font-size:14px;margin-left:25px;color:#909090;">其他说明：{{professionRequest.jobOtherNotice}}</span>
                            </el-row>
                        </el-col>
                    </el-row>
                </el-row>
                <el-row style="margin-left:60px;margin-right:60px;margin-top:20px;">
                    <el-row>
                        <i class="el-icon-s-check" style="font-size:25px;color:#409EFF;"></i>
                        <span style="color:#409EFF">录用条件</span>
                    </el-row>
                    <el-row style="height:100px;margin-top:10px;">
                        <el-col>
                            <el-row > 
                                <span style="font-size:14px;margin-left:25px;color:#909090;">性别条件：{{employRequest.sexRequest}}</span>
                            </el-row>
                            <el-row style="margin-top:10px">
                                <span style="font-size:14px;margin-left:25px;color:#909090;">年龄条件：{{employRequest.ageRequest}}</span>
                            </el-row>
                            <el-row style="margin-top:10px">
                                <span style="font-size:14px;margin-left:25px;color:#909090;">学历条件：{{employRequest.educationBackgroundRequest}}</span>
                            </el-row>
                            <el-row style="margin-top:10px">
                                <span style="font-size:14px;margin-left:25px;color:#909090;">经验条件：{{employRequest.expRequest}}</span>
                            </el-row>
                            <el-row style="margin-top:10px">
                                <span style="font-size:14px;margin-left:25px;color:#909090;">证书条件：{{employRequest.credentialRequest}}</span>
                            </el-row>
                            <el-row style="margin-top:10px">
                                <span style="font-size:14px;margin-left:25px;color:#909090;">其他说明：{{employRequest.employOtherNotice}}</span>
                            </el-row>
                        </el-col>
                    </el-row>
                </el-row>
                <el-row style="margin-left:60px;margin-right:60px;margin-top:20px;height:220px;">
                    <el-row>
                        <i class="el-icon-tickets" style="font-size:25px;color:#409EFF;"></i>
                        <span style="color:#409EFF">公司简介</span>
                    </el-row>
                    <el-row style="margin-top:10px;">
                        <el-col>
                            <el-row style="height:90px;">
                                <el-col style="height:100%;" :span="3" class="goCenterUp">
                                    <span style="font-size:14px;margin-left:25px;color:#909090;">公司照片：</span>
                                </el-col>
                                <el-col :span="3">
                                    <el-image :src="companyPicture" style="height:90px;width:90px;">
                                    </el-image>
                                </el-col>
                            </el-row>
                            <el-row style="margin-top:10px"> 
                                <span style="font-size:14px;margin-left:25px;color:#909090;">{{company.companyIntroduction}}</span>
                            </el-row>
                            <el-row style="margin-top:10px">
                                <span style="font-size:14px;margin-left:25px;color:#909090;">联系方式：{{company.companyContact}}</span>
                            </el-row>
                            <el-row style="margin-top:10px;">
                                <span style="font-size:14px;margin-left:25px;color:#909090;">公司地址：{{company.companyAddress}}</span>
                            </el-row>
                        </el-col>
                    </el-row>
                </el-row>
            </el-main>
        </el-container>
    </div>    
</template>

<script>
export default {
    data(){
        return{
            consignId:'',
            consignName:'电工',
            companyName:'杭州润实',
            consignNum:'10',
            //委培详情
            consignOutline:{},
            //公司简介
            company:{},
            //录用条件
            employRequest:{},
            //岗位要求
            professionRequest:{},
            //住宿饮食
            liveAndFoodOutline:{},
            //工资待遇
            salaryOutline:{},
            //公司照片
            companyPicture:'',
        }
    },
    mounted(){
        var consignId=this.$route.query.consignId;
        this.consignId=consignId;
        this.login();
        this.getConsiginInfo();
    },
    methods:{
        //发布
        faBu(){
            var URL='http://47.101.180.43:8075/post/postAudit';
            console.log(URL);
            this.$ajax({
                method:'get',
                url:URL,
                params:{
                   postId:this.consignId
                }
            }).then(response=>{
                console.log(response.data.data);
                var code=response.data.code;
                if(code==0){
                    this.$notify({
                        message:response.data.data,
                        type: 'success'
                    });
                    this.$router.push({
                        path:'/home/consign',
                    })
                }else{
                    this.$message.error(response.data.msg);
                }
            }).catch(error=>{
                console.log(error);
            })
        },
        //驳回
        boHui(){
            var URL='http://47.101.180.43:8075/post/postReject';
            console.log(URL);
            this.$ajax({
                method:'get',
                url:URL,
                params:{
                   postId:this.consignId
                }
            }).then(response=>{
                console.log(response.data.data);
                var code=response.data.code;
                if(code==0){
                    this.$notify({
                        message:response.data.data,
                    });
                    this.$router.push({
                        path:'/home/consign',
                    })
                }else{
                    this.$message.error(response.data.msg);
                }
            }).catch(error=>{
                console.log(error);
            })
        },
        //测试用登录
        login(){
            var URL='http://47.101.180.43:8075/user/login'
                        this.$ajax({
                            method:'post',
                            url:URL,
                            data:{
                                username:'root',
							    password:'test',
                            },
                        }).then(response=>{
                            console.log(response.data);
                            var code=response.data.code;
                            if(code==0){
                                console.log(response.data.data); 
                            }else{
                               	console.log(response.data.msg); 
								this.$notify.error({
									message:'邮箱或密码错误'
								});
                            }
                        }).catch(error=>{
                            console.log(error);
                        })
        },
        //获取招聘详细信息
        getConsiginInfo(){
            var URL='http://47.101.180.43:8075/consign/getConsignInformation';
            console.log(URL);
            this.$ajax({
                method:'get',
                url:URL,
                params:{
                    consignId:this.consignId
                }
            }).then(response=>{
                console.log(response.data);
                var code=response.data.code;
                if(code==0){
                   this.liveAndFoodOutline=response.data.data.liveAndFoodOutline;
                   this.salaryOutline=response.data.data.salaryOutline;
                   this.employRequest=response.data.data.employRequest;
                   this.professionRequest=response.data.data.professionRequest;
                   this.consignOutline=response.data.data.consignOutline;
                   this.company=response.data.data.company;
                   this.consignName=response.data.data.companyInformation.positionName;
                   this.companyName=response.data.data.companyInformation.companyName;
                   this.consignNum=response.data.data.companyInformation.requirePopulation;
                   this.companyPicture=response.data.data.companyInformation.companyPicture;
                }else{
                    this.$message.error(response.data.msg);
                }
            }).catch(error=>{
                console.log(error);
            })
        },
    },
}
</script>

<style>
.juZhong{
    display:flex;
    align-items:center;
    justify-content:center
}
.line{
    height:10px;
    background-color: #F0F0F0;
}
.goCenterUp{
    display: flex;
    align-items: center
}
</style>